# -*- coding: utf-8 -*- #
"""Settings file for whole application"""
from tornado_jinja2 import Jinja2Loader
from tornado.options import options
import os

DEBUG = True
env = options.app
port = options.port

IS_CHECK_SIGN = False
PUBLIC_KEY = '56CD79BAB508342D8B2BAEEABD70021B'  # 公钥
# 服务器图片保存目录
IMG_BASE_PATH = '/usr/share/nginx/static/img/'
IMG_BASE_URL = 'http://app.qcjkjg.com/media/img/'
AUDIO_BASE_URL = 'http://app.qcjkjg.com/media/audio/'
VIDEO_BASE_URL = 'http://app.qcjkjg.com/media/video/'

MYSQL_APP_HOST = '47.92.112.59'
MYSQL_APP_DBNAME = 'qicheng'
MYSQL_APP_USERNAME = 'qic'
MYSQL_APP_PASSWORD = 'qic2017.,/'


NEWS_MAP = {
    "1":{
        "1": [37],
        "2": [45],
        "3": [],
    },
    "2":{
        "1": [70],
        "2": [78, 79, 80, 81, 82, 83, 84, 85, 86],
        "3": [72, 73, 74, 75, 76],
    },
    "3":{
        "1": [98],
        "2": [102, 103, 104, 105, 106],
        "3": [100],
    },
    "4":{
        "1": [108],
        "2": [109],
        "3": [],
    }
}

PAY_TYPE = {
    "app":{'appid':'wxd2a8a6d807625124','mch_id':'1487603952','signkey':'84F6CA59E18DF9C6784CEE7E4292AFB7','trade_type':'APP'},
    "gzh":{'appid':'wxce3ced320373d100', 'appsecret': '7876e69a2f28e791f2c8f7e89a015ecc', 'mch_id':'1484395802','signkey':'Bazhangnetyuyangji20180323liuwei','trade_type':'JSAPI'}
    # "gzh":{'appid':'wxce3ced320373d100', 'appsecret': '7876e69a2f28e791f2c8f7e89a015ecc', 'mch_id':'1484395802','signkey':'QWLS00B6OGQYDMZ3FBYYJMGEYD1A87SZ','trade_type':'JSAPI'}
            }

ALI_PARTNER = {'partner': '2088402196808813', 'seller_id': '2088402196808813', 'appid': '2017072207847700'}  # 支付宝 partnerid（多APP公用）


# 客户端app连接配置
mysql_conn_app_dict = dict(host=MYSQL_APP_HOST, port=3306,
                           user=MYSQL_APP_USERNAME,
                           pwd=MYSQL_APP_PASSWORD,
                           db=MYSQL_APP_DBNAME, charset='utf8',
                           max_idle_connections=10,
                           max_open_connections=100, max_recycle_sec=3)

DEFAULT_NICKNAME = u'匿名'
DEFAULT_AVATAR = IMG_BASE_URL + 'avatar/default.png'


print 'app server run port:%s' % str(port)

APPLICATION_SETTINGS = dict(
    debug=DEBUG,
    cookie_secret='random key',
    login_url='/login',
    template_loader=Jinja2Loader('./templates/'),
    static_path=os.path.join(os.path.dirname(__file__), 'static')
    )

